@extends('admin.readLayout')
@section('title','推广详情')
@section('css')

    <link rel="stylesheet" type="text/css" href="{{asset('manger/plugins/zTree_v3/css/zTreeStyle/zTreeStyle.css')}}"/>
    <style>
        .ztree * {padding:0; margin:0; font-size:14px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
    </style>
@endsection
@section('content')
    <blockquote class="layui-elem-quote">基本资料</blockquote>

        <div class="layui-colla-content layui-show">
            <div class="layui-row">
                <div class="layui-col-md4 ">
                    <img src="{{asset($model->headimgurl)}}" class="layui-circle" style="height: 160px;width: 160px"/>

                </div>
                <div class="layui-col-md4 layui-col-md-offset4 layui-edge-right" style="padding-left: 5px;">
                    <p>昵称：{{$model->nickname}}</p>
                    <p>身份：{{\App\Http\Controllers\Admin\Member\Service\Member::getRoleList()[$model->role]}}</p>
                    <p>性别：{{\App\Http\Controllers\Admin\Member\Service\Member::getSexList()[$model->sex]}}</p>
                    <p>手机号：{{$model->mobile}}</p>
                    @if($model->parent)
                        <p>推广人：<a href="{{route($routePrefix.'.distribute',$model->parent->id)}}" style="color:#3b97d7" class="openInLayer">{{$model->parent->nickname}}</a></p>
                    @endif
                    <p>团队人数：{{count($tree)-1}}人</p>
                    <p>累计提成：￥{{number_format($model->wallet_all_push_money,2)}}</p>
                    <p>剩余提成：￥{{number_format($model->wallet_push_money,2)}}</p>
                    <p>已提现：￥{{number_format($model->wallet_used_push_money,2)}}</p>
                    @if($model->bankId)
                    <p>银行：{{$model->bankId}} <img src="{{getBankImg($model->bankId)}}"/></p>
                    @endif

                </div>
            </div>
            <hr/>

        </div>
    <blockquote class="layui-elem-quote">推广团队</blockquote>

    <div class="layui-row">
        <ul id="treeDemo" class="ztree"></ul>

    </div>
@endsection

@section('script')
    <script src="{{asset('manger/plugins/zTree_v3/js/jquery-1.4.4.min.js')}}"></script>
    <script src="{{asset('manger/plugins/zTree_v3/js/jquery.ztree.all.js')}}"></script>
    <script>
        var zNodes = {!! json_encode($tree) !!};
        var setting = {
            view: {
                dblClickExpand: true,
                showLine: true,
                showIcon:true,
                selectedMulti: false,
                showTitle:true,
            },
            edit: {
                enable:false,
                showRemoveBtn:false,
                showRenameBtn:false,
                drag:{
                    autoExpandTrigger: true,
                    prev: true,
                    inner: true,
                    next: true,
                    isMove:true
                }
            },
            data: {
                simpleData: {
                    enable:true,
                    idKey: "id",
                    pIdKey: "pid",
                    rootPId: "0"
                },
                view: {
                    showIcon: true,
                    showLine: true
                },
                key:{
                    name:'nickname',
                    url:'url'
                }
            },
            callback: {

            }
        };
        var t = $("#treeDemo");
        $(document).ready(function(){
            t = $.fn.zTree.init(t, setting, zNodes);
        });
    </script>
    <script>
        //注意：折叠面板 依赖 element 模块，否则无法进行功能性操作
        layui.use(['element','jquery','layer'], function(){
            var element = layui.element;
            var $ = layui.jquery;
            var layer = layui.layer;
            $(window).one("resize",function(){
                $(".openInLayer").click(function(e){
                    e.preventDefault();
                    var _url = $(this).attr('href');
                    var index = layui.layer.open({
                        title : "推广人",
                        type : 2,
                        content : _url,
                        success : function(layero, index){
                            setTimeout(function(){
                                layui.layer.tips('点击此处返回', '.layui-layer-setwin .layui-layer-close', {
                                    tips: 3
                                });
                            },500)
                        }
                    })
                    layui.layer.full(index);
                })

            }).resize();
            //…
        });
    </script>
@endsection